﻿using System;
using System.Collections.Generic;
using W2R.Core.Models.Entities;

namespace W2R.Core.Models.DataAccess
{
    public interface IBooksRepo
    {
        #region Methods

        /// <summary>
        /// Gets a single instance by its identifier
        /// </summary>
        /// <param name="id">Entity's di</param>
        /// <returns>The instance for this id</returns>
        Book Get(Guid id);

        /// <summary>
        /// Gets all the entities
        /// </summary>
        /// <returns>A list of entities</returns>
        IEnumerable<Book> GetAll();

        /// <summary>
        /// Get all the entities that satisfied a given predicate
        /// </summary>
        /// <param name="predicate">a predicate for filter</param>
        /// <returns></returns>
        IEnumerable<Book> GetBy(Func<Book, bool> predicate);


        /// <summary>
        /// Persists an entity in the database
        /// </summary>
        /// <param name="entity">Entity to be persisted</param>
        /// <returns>The persisted entity</returns>
        Book Add(Book entity);

        /// <summary>
        /// Updates the current entity
        /// </summary>
        /// <param name="entity">entity to update</param>
        /// <returns></returns>
        Book Update(Book entity);

        /// <summary>
        /// Removes the current entity of the system.
        /// </summary>
        /// <param name="entity">Entity to be removed</param>
        /// <returns></returns>
        Book Remove(Book entity);

        #endregion
    }
}
